<%@ Page Language="C#" AutoEventWireup="true" StylesheetTheme="YUI" CodeFile="ManageStudents.aspx.cs"
    Inherits="Home_ManageStudents" %>

<%@ Register Src="../UserControls/Menu.ascx" TagName="Menu" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>PlacementManager: Manage Students</title>

    <script language="javascript" type="text/javascript">
     
    function showToolTip(e,text){ 
      var ToolTip = document.getElementById("ToolTip");
      ToolTip.innerHTML=text; 
      ToolTip.style.left=(e.clientX+15+document.body.scrollLeft)+'px'; 
      ToolTip.style.top=(e.clientY+document.body.scrollTop)+'px'; 
      ToolTip.style.display="block"; 
    } 
    function hideToolTip(){ 
        var ToolTip = document.getElementById("ToolTip");
        ToolTip.style.display="none"; 
    } 
    </script>

    <script language="javascript" type="text/javascript">
    
    function showAddNote()
    {
        var divToShow = document.getElementById("divAddNote");
        divToShow.style.display = "block";
    }
    function hideAddNote()
    {
        var divToHide = document.getElementById("divAddNote");
        divToHide.style.display = "none";
    }
    </script>

    <style type="text/css">
        .completionListElement1
        {
            visibility: hidden;
            margin: 0px !important;
            background-color: white;
            color: blue;
            border: solid 1px gray;
            cursor: hand;
            text-align: left;
            list-style-type: none;
            font-family: Verdana;
            font-size: 11px;
            padding: 0;
            z-index: 2 !important;
        }
        .gridZIndex
        {
            z-index: -1;
            font-size: 11px;
            color: #000000;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnableScriptGlobalization="True">
    </ajaxToolkit:ToolkitScriptManager>
    <div id="doc3" class="yui-t3">
        <div id="hd">
            <asp:Panel ID="pnlMenu" runat="server">
                <uc1:Menu ID="Menu1" runat="server"></uc1:Menu>
            </asp:Panel>
        </div>
        <div id="bd">
            <h1>
                Manage Students</h1>
            <asp:UpdatePanel ID="updtpnlFilter" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                <ContentTemplate>
                    <table id="tblFilters">
                        <tr>
                            <td>
                                <asp:Label ID="lblSearchFirstName" CssClass="formLabel" runat="server" AssociatedControlID="txtSearchFirstName"
                                    Text="First Name:" ToolTip="Enter the first name of the student."></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lblSearchLastName" runat="server" AssociatedControlID="txtSearchLastName"
                                    CssClass="formLabel" Text="Last Name:" ToolTip="Enter the last name of the student."></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lblSearchStudentNumber" runat="server" AssociatedControlID="txtSearchStudentNumber"
                                    CssClass="formLabel" Text="Student Number:" ToolTip="Enter the student number."></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lblCurrentlyEnrolledIn" runat="server" AssociatedControlID="ddUnits"
                                    CssClass="formLabel" Text="Currently Enrolled in:" ToolTip="Select the unit"></asp:Label>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:TextBox ID="txtSearchFirstName" runat="server" MaxLength="20" Width="90px"></asp:TextBox>
                            </td>
                            <td>
                                <asp:TextBox ID="txtSearchLastName" runat="server" MaxLength="20" Width="90px"></asp:TextBox>
                            </td>
                            <td>
                                <asp:TextBox ID="txtSearchStudentNumber" runat="server" MaxLength="20" Width="90px"></asp:TextBox>
                            </td>
                            <td>
                                <asp:DropDownList ID="ddUnits" runat="server" DataSourceID="ldsSearchUnits" DataTextField="UnitCode"
                                    DataValueField="UnitId">
                                </asp:DropDownList>
                                <asp:LinqDataSource ID="ldsSearchUnits" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                                    OrderBy="UnitCode" TableName="Units">
                                </asp:LinqDataSource>
                            </td>
                            <td>
                                <asp:ImageButton ID="imgbtnSimpleSearch" runat="server" ImageUrl="~/Images/Icons/search.gif"
                                    OnClick="imgbtnSimpleSearch_Click" />
                            </td>
                        </tr>
                    </table>
                    <ajaxToolkit:AutoCompleteExtender ID="aceSearchFirstName" runat="server" ServiceMethod="GetFirstName"
                        ServicePath="../WebServices/StudentService.asmx" TargetControlID="txtSearchFirstName"
                        CompletionListCssClass="completionListElement1">
                    </ajaxToolkit:AutoCompleteExtender>
                    <ajaxToolkit:AutoCompleteExtender ID="aceSearchLastName" runat="server" ServiceMethod="GetLastName"
                        ServicePath="../WebServices/StudentService.asmx" TargetControlID="txtSearchLastName"
                        CompletionListCssClass="completionListElement1">
                    </ajaxToolkit:AutoCompleteExtender>
                    <ajaxToolkit:AutoCompleteExtender ID="aceSearchIdNumber" runat="server" ServiceMethod="GetIdNumber"
                        ServicePath="../WebServices/StudentService.asmx" TargetControlID="txtSearchStudentNumber"
                        CompletionListCssClass="completionListElement1">
                    </ajaxToolkit:AutoCompleteExtender>
                </ContentTemplate>
            </asp:UpdatePanel>
            &nbsp;
            <div class="yui-b">
                <asp:UpdatePanel ID="updtpnlStudentsGrid" runat="server" UpdateMode="Conditional">
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="imgbtnSimpleSearch" EventName="Click" />
                        <%--
                        <asp:AsyncPostBackTrigger ControlID="tabcontStudents$" EventName="ItemUpdated" />--%>
                    </Triggers>
                    <ContentTemplate>
                        <asp:GridView ID="gvStudents" runat="server" AllowPaging="True" AllowSorting="True"
                            AutoGenerateColumns="False" DataSourceID="ldsStudentslists" SelectedIndex="0"
                            SkinID="Results" DataKeyNames="UserId" OnSelectedIndexChanged="gvStudents_SelectedIndexChanged"
                            PageSize="15" OnDataBound="gvStudents_DataBound" OnPageIndexChanged="gvStudents_PageIndexChanged"
                            CssClass="gridZIndex">
                            <Columns>
                                <asp:CommandField ButtonType="Image" SelectImageUrl="~/Images/Icons/edit.gif" ShowSelectButton="True" />
                                <asp:BoundField DataField="IdNumber" HeaderText="Student No." SortExpression="IdNumber" />
                                <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
                                <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
                            </Columns>
                            <PagerStyle ForeColor="Black" />
                            <EmptyDataTemplate>
                                No users found.
                            </EmptyDataTemplate>
                            <HeaderStyle ForeColor="Black" />
                        </asp:GridView>
                        <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="30" DynamicLayout="false">
                            <ProgressTemplate>
                                <div class="progressBackgroundFilter">
                                </div>
                                <div class="processMessage">
                                    <p align="center">
                                        <br />
                                        <img src="../Images/bigrotation2.gif" alt="Loading" align="middle" />
                                        <br />
                                        Loading...</p>
                                </div>
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
            <div id="yui-main">
                <div class="yui-b">
                    <asp:UpdatePanel ID="updtPnlName" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:FormView ID="fvName" runat="server" Width="100%" DataSourceID="ldsStudentDetails">
                                <ItemTemplate>
                                    <h2>
                                        <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Bind("FirstName") %>'></asp:Label>
                                        <asp:Label ID="LastNameLabel" runat="server" Text='<%# Bind("LastName") %>'></asp:Label>
                                    </h2>
                                </ItemTemplate>
                            </asp:FormView>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="SelectedIndexChanged" />
                            <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="DataBound" />
                        </Triggers>
                    </asp:UpdatePanel>
                    <ajaxToolkit:TabContainer ID="tabcontStudents" runat="server" 
                        ActiveTabIndex="1">
                        <ajaxToolkit:TabPanel ID="tabpnlDetails" runat="server" HeaderText="Details">
                            <ContentTemplate>
                                <asp:UpdatePanel ID="updtpnlStudentDetails" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <asp:FormView ID="fvUser" runat="server" Width="100%" DataSourceID="ldsStudentDetails">
                                            <ItemTemplate>
                                                <table class="AddEditPresentData">
                                                    <tr>
                                                        <td class="LeftCol">
                                                            <span class="formLabel">Student Number:</span>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="IdNumberLabel" runat="server" Text='<%# Bind("IdNumber") %>'></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">First Name:</span>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("FirstName") %>'></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">Last Name:</span>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("LastName") %>'></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">DateCreated:</span>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="DateCreatedLabel" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DateCreated", "{0:dddd d MMMM yyyy}") %>'></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">CreatedBy:</span>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="CreatedByLabel" runat="server" Text='<%# Bind("CreatedBy") %>'></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">DateUpdated:</span>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="DateUpdatedLabel" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DateUpdated", "{0:dddd d MMMM yyyy}") %>'></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">UpdatedBy:</span>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="UpdatedByLabel" runat="server" Text='<%# Bind("UpdatedBy") %>'></asp:Label>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ItemTemplate>
                                        </asp:FormView>
                                        <fieldset>
                                            <asp:ListView ID="lvUserContactNumbers" runat="server" DataKeyNames="UserContactNumberId"
                                                InsertItemPosition="LastItem" DataSourceID="ldsContactContactNumber" OnItemInserting="lvUserContactNumbers_ItemInserting">
                                                <LayoutTemplate>
                                                    <div id="itemPlaceholderContainer" runat="server" style="">
                                                        <span id="itemPlaceholder" runat="server"></span>
                                                    </div>
                                                </LayoutTemplate>
                                                <InsertItemTemplate>
                                                    <table>
                                                        <tr>
                                                            <td colspan="2">
                                                                &nbsp;
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2">
                                                                <asp:Label ID="Label4" runat="server" BorderColor="#CCCCCC" Font-Underline="True"
                                                                    ForeColor="Black" Text="Add contact numbers:"></asp:Label>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2">
                                                                &nbsp;&nbsp;
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Contact Number:
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="ContactNumberTextBox" runat="server" Text='<%# Bind("ContactNumberValue") %>'
                                                                    ValidationGroup="InsertContactNumberGroup"></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                                                                    ControlToValidate="ContactNumberTextBox" ValidationGroup="InsertContactNumberGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Contact Type:
                                                            </td>
                                                            <td>
                                                                <asp:DropDownList ID="ContactTypeDropDown" runat="server" DataSourceID="ldsContactNumberTypes"
                                                                    DataTextField="ContactNumberTypeName" DataValueField="ContactNumberTypeId" Font-Size="8pt"
                                                                    Height="19px" ValidationGroup="InsertContactNumberGroup" Width="155px">
                                                                </asp:DropDownList>
                                                                <asp:RequiredFieldValidator ID="ContactNumberTypeValidator" runat="server" ControlToValidate="ContactTypeDropDown"
                                                                    ErrorMessage="*" ValidationGroup="InsertContactNumberGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2">
                                                                &nbsp;
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:ImageButton ID="BtnSave" runat="server" CausesValidation="true" CommandName="Insert"
                                                                    ImageUrl="~/Images/Icons/diskette.gif" ToolTip="Save" ValidationGroup="InsertContactNumberGroup" />
                                                                &nbsp;
                                                                <asp:ImageButton ID="BtnCancel" runat="server" CausesValidation="False" CommandName="Cancel"
                                                                    ImageUrl="~/Images/Icons/against.gif" ToolTip="Cancel" />
                                                            </td>
                                                            <td>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </InsertItemTemplate>
                                                <ItemTemplate>
                                                    <table>
                                                        <tr>
                                                            <td colspan="2">
                                                                &nbsp;&nbsp;
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:ImageButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
                                                                    ImageAlign="Baseline" ImageUrl="~/Images/Icons/x.gif" ToolTip="Delete" ValidationGroup="insertCategory" />
                                                                &nbsp;
                                                                <ajaxToolkit:ConfirmButtonExtender ID="DeleteButton_ConfirmButtonExtender" runat="server"
                                                                    ConfirmText="Are you sure you want to delete this item?" Enabled="True" TargetControlID="DeleteButton">
                                                                </ajaxToolkit:ConfirmButtonExtender>
                                                            </td>
                                                            <td style="table-layout: fixed">
                                                                <asp:Label ID="ContactTypeNameLabel" runat="server" Text='<%# Eval("ContactNumber.ContactNumberType.ContactNumberTypeName") %>'></asp:Label>:
                                                                &nbsp;
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="ContactNumberValueLabel" runat="server" Text='<%# Eval("ContactNumber.ContactNumberValue") %>'></asp:Label>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </ItemTemplate>
                                            </asp:ListView>
                                            <asp:LinqDataSource ID="ldsContactContactNumber" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                                                TableName="UserContactNumbers" EnableDelete="True" EnableInsert="True" Where="UserId == @UserId">
                                                <WhereParameters>
                                                    <asp:ControlParameter ControlID="gvStudents" Name="UserId" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                </WhereParameters>
                                            </asp:LinqDataSource>
                                            <asp:LinqDataSource ID="ldsContactNumberTypes" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                                                TableName="ContactNumberTypes">
                                            </asp:LinqDataSource>
                                        </fieldset>
                                        <asp:Image ID="imgStudent" runat="server" ImageUrl="~/Images/StandardUserImage.jpg" />
                                    </ContentTemplate>
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="SelectedIndexChanged" />
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="DataBound" />
                                    </Triggers>
                                </asp:UpdatePanel>
                            </ContentTemplate>
                            <HeaderTemplate>
                                Details
                            </HeaderTemplate>
                        </ajaxToolkit:TabPanel>
                        <ajaxToolkit:TabPanel ID="tabpnlAddresses" runat="server" HeaderText="Addresses">
                            <HeaderTemplate>
                                Addresses
                            </HeaderTemplate>
                            <ContentTemplate>
                                <asp:UpdatePanel ID="updtpnlStudentAddresses" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <fieldset dir="ltr">
                                            <legend>Addresses</legend>
                                            <asp:ListView ID="lvStudentAddresses" runat="server" DataKeyNames="AddressId" DataSourceID="ldsStudentAddresses"
                                                InsertItemPosition="LastItem" OnItemUpdating="lvStudentAddresses_ItemUpdating"
                                                OnItemInserting="lvStudentAddresses_ItemInserting">
                                                <LayoutTemplate>
                                                    <div id="itemPlaceholderContainer" runat="server" style="">
                                                        <span id="itemPlaceholder" runat="server" />
                                                    </div>
                                                    <div style="">
                                                    </div>
                                                </LayoutTemplate>
                                                <InsertItemTemplate>
                                                    <table>
                                                        <br />
                                                        <tr>
                                                            <td colspan="2">
                                                                <asp:Label ID="Label4" runat="server" BorderColor="#CCCCCC" Text="Insert new address:"
                                                                    Font-Underline="True" ForeColor="Black"></asp:Label>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2">
                                                                &#160;&nbsp;
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Address1:
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="Address1TextBox" runat="server" Text='<%# Bind("Address1") %>' ValidationGroup="InsertAddressGroup"></asp:TextBox>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="Address1TextBox"
                                                                    ErrorMessage="*" ValidationGroup="InsertAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Address2:
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="Address2TextBox" runat="server" Text='<%# Bind("Address2") %>' ValidationGroup="InsertAddressGroup"></asp:TextBox>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="Address2TextBox"
                                                                    ErrorMessage="*" ValidationGroup="InsertAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Street:
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="StreetTextBox" runat="server" Text='<%# Bind("Street") %>' ValidationGroup="InsertAddressGroup"></asp:TextBox>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="StreetTextBox"
                                                                    ErrorMessage="*" ValidationGroup="InsertAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                City:
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>' ValidationGroup="InsertAddressGroup"></asp:TextBox>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="CityTextBox"
                                                                    ErrorMessage="*" ValidationGroup="InsertAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                PostCode:
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="PostCodeTextBox" runat="server" Text='<%# Bind("PostCode") %>'></asp:TextBox>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="PostCodeTextBox"
                                                                    ErrorMessage="*" ValidationGroup="InsertAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                State:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:DropDownList ID="State" runat="server" DataSourceID="ldsGeo_States" DataTextField="DivisionName"
                                                                        DataValueField="AdministrativeDivisionID" Font-Size="8pt" Height="19px" Width="155px"
                                                                        ValidationGroup="InsertAddressGroup">
                                                                        <asp:ListItem Selected="True"></asp:ListItem>
                                                                    </asp:DropDownList>
                                                                </span>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="State"
                                                                    ErrorMessage="*" ValidationGroup="InsertAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Country:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:DropDownList ID="Country" runat="server" DataSourceID="ldsCountry" DataTextField="CountryName"
                                                                        DataValueField="CountryID" Height="19px" Width="155px" Font-Size="8pt" ValidationGroup="InsertAddressGroup">
                                                                        <asp:ListItem Selected="True"></asp:ListItem>
                                                                    </asp:DropDownList>
                                                                </span>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="Country"
                                                                    ErrorMessage="*" ValidationGroup="InsertAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Is Postal:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:CheckBox ID="lbleditIsPostal" runat="server" Checked='<%# Bind("isPostal") %>' /></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Is Primary:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:CheckBox ID="lbleditIsPrimary" runat="server" Checked='<%# Bind("isPrimary") %>' /></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2">
                                                                <asp:CustomValidator ID="PrimaryAddressValidator" runat="server" ErrorMessage="There can only be one primary address!"></asp:CustomValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td class="style2">
                                                                <asp:ImageButton ID="AddressNewSaveBtn" runat="server" CommandName="Insert" ImageUrl="~/Images/Icons/diskette.gif"
                                                                    ToolTip="Insert" ValidationGroup="InsertAddressGroup" />&#160;&nbsp;<asp:ImageButton
                                                                        ID="NewAddressCancelBtn" runat="server" CommandName="Cancel" ImageUrl="~/Images/Icons/against.gif"
                                                                        CausesValidation="false" ToolTip="Cancel" ValidationGroup="InsertAddressGroup" />
                                                            </td>
                                                            <td class="style2">
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </InsertItemTemplate>
                                                <EmptyDataTemplate>
                                                    <span>No data was returned.</span></EmptyDataTemplate>
                                                <EditItemTemplate>
                                                    <table>
                                                        <tr>
                                                            <br></br>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Address1:
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="EditAddress1" runat="server" Text='<%# Bind("Address1") %>' ValidationGroup="EditAddressGroup"></asp:TextBox>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="EditAddress1"
                                                                    ErrorMessage="*" ValidationGroup="EditAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Address2:
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="EditAddress2" runat="server" Text='<%# Bind("Address2") %>' ValidationGroup="EditAddressGroup"></asp:TextBox>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="EditAddress2"
                                                                    ErrorMessage="*" ValidationGroup="EditAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Street:
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="EditStreet" runat="server" Text='<%# Bind("Street") %>' ValidationGroup="EditAddressGroup"></asp:TextBox>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="EditStreet"
                                                                    ErrorMessage="*" ValidationGroup="EditAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                City:
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="EditCity" runat="server" Text='<%# Bind("City") %>' ValidationGroup="EditAddressGroup"></asp:TextBox>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="EditCity"
                                                                    ErrorMessage="*" ValidationGroup="EditAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                PostCode:
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="EditPostCodeTextBox" runat="server" Text='<%# Bind("PostCode") %>'
                                                                    ValidationGroup="EditAddressGroup"></asp:TextBox>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="EditPostCodeTextBox"
                                                                    ErrorMessage="*" ValidationGroup="EditAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                State:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:DropDownList ID="EditState" runat="server" AutoPostBack="false" DataSourceID="ldsGeo_States"
                                                                        DataTextField="DivisionName" DataValueField="AdministrativeDivisionID" Height="19px"
                                                                        Width="155px" SelectedValue='<%# Bind("StateId") %>' Font-Size="8pt" ValidationGroup="EditAddressGroup">
                                                                        <asp:ListItem Selected="True"></asp:ListItem>
                                                                    </asp:DropDownList>
                                                                </span>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" ControlToValidate="EditState"
                                                                    ErrorMessage="*" ValidationGroup="EditAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Country:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:DropDownList ID="EditCountry" runat="server" AutoPostBack="False" DataSourceID="ldsCountry"
                                                                        DataTextField="CountryName" DataValueField="CountryID" SelectedValue='<%# Bind("CountryId") %>'
                                                                        Height="19px" Width="155px" Font-Size="8pt" ValidationGroup="EditAddressGroup">
                                                                        <asp:ListItem Selected="True"></asp:ListItem>
                                                                    </asp:DropDownList>
                                                                </span>
                                                            </td>
                                                            <td class="style2">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ControlToValidate="EditCountry"
                                                                    ErrorMessage="*" ValidationGroup="EditAddressGroup"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Is Postal:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:CheckBox ID="lbleditIsPostal" runat="server" Checked='<%# Bind("isPostal") %>' /></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Is Primary:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:CheckBox ID="lbleditIsPrimary" runat="server" Checked='<%# Eval("UserAddresses[0].isPrimary") %>' /></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2">
                                                                <asp:CustomValidator ID="EditPrimaryAddressValidator" runat="server" ErrorMessage="There can only be one primary address!"></asp:CustomValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:ImageButton ID="ImageButton1" runat="server" CommandName="Update" ImageUrl="~/Images/Icons/diskette.gif"
                                                                    ValidationGroup="EditAddressGroup" />&#160;&nbsp;<asp:ImageButton ID="NewAddressCancelBtn"
                                                                        runat="server" CommandName="Cancel" ImageUrl="~/Images/Icons/against.gif" CausesValidation="false"
                                                                        ToolTip="Cancel" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <table>
                                                        <tr>
                                                            <td>
                                                                Address1:
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="Address1Label" runat="server" Text='<%# Eval("Address1") %>' />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Address2:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:Label ID="Address2Label" runat="server" Text='<%# Eval("Address2") %>'></asp:Label></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Street:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:Label ID="StreetLabel" runat="server" Text='<%# Eval("Street") %>'></asp:Label></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                City:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>'></asp:Label></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                PostCode:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:Label ID="PostCodeLabel" runat="server" Text='<%# Eval("PostCode") %>'></asp:Label></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                State:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:Label ID="StateIdLabel" runat="server" Text='<%# Eval("Geo_AdministrativeDivision.DivisionName") %>'></asp:Label></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Country:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:Label ID="CountryIdLabel" runat="server" Text='<%# Eval("Geo_Country.CountryName") %>'></asp:Label></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Is Postal:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:CheckBox ID="Label3" runat="server" Enabled="false" Checked='<%# Eval("isPostal") %>' /></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                Is Primary:
                                                            </td>
                                                            <td>
                                                                <span>
                                                                    <asp:CheckBox ID="Label5" runat="server" Enabled="false" Checked='<%# Eval("UserAddresses[0].isPrimary") %>' /></span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                DateCreated:
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="DateCreatedTextBox" runat="server" Text='<%# Bind("DateCreated") %>' />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                CreatedBy:
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="CreatedByTextBox" runat="server" Text='<%# Bind("CreatedBy") %>' />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                DateUpdated:
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="DateUpdatedTextBox" runat="server" Text='<%# Bind("DateUpdated") %>' />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                UpdatedBy:
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="UpdatedByTextBox" runat="server" Text='<%# Bind("UpdatedBy") %>' />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                &#160;&nbsp;
                                                            </td>
                                                            <td>
                                                                &#160;&nbsp;
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:ImageButton ID="BtnEdit" runat="server" CausesValidation="False" CommandName="Edit"
                                                                    ImageUrl="~/Images/Icons/refresh.gif" ToolTip="Edit" />&#160;&nbsp;
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <br />
                                                        </tr>
                                                    </table>
                                                </ItemTemplate>
                                                <ItemSeparatorTemplate>
                                                    <div style="height: 5px; width: 100%; border-top: dashed 1px #ff0000; border-color: #D3D3D3;
                                                        border-top-style: solid; border-top-width: thin;">
                                                    </div>
                                                </ItemSeparatorTemplate>
                                            </asp:ListView>
                                            <asp:LinqDataSource ID="ldsStudentAddresses" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                                                TableName="Addresses" EnableInsert="True" EnableUpdate="True" OnSelecting="ldsStudentAddresses_Selecting">
                                            </asp:LinqDataSource>
                                            <asp:LinqDataSource ID="ldsCountry" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                                                Select="new (CountryName, CountryID)" TableName="Geo_Countries" OrderBy="CountryName">
                                            </asp:LinqDataSource>
                                            <asp:LinqDataSource ID="ldsGeo_States" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                                                TableName="Geo_AdministrativeDivisions">
                                            </asp:LinqDataSource>
                                        </fieldset>
                                    </ContentTemplate>
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="SelectedIndexChanged" />
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="DataBound" />
                                    </Triggers>
                                </asp:UpdatePanel>
                            </ContentTemplate>
                        </ajaxToolkit:TabPanel>
                        <ajaxToolkit:TabPanel ID="tabpnlUnits" runat="server" HeaderText="Units">
                            <HeaderTemplate>
                                Units
                            </HeaderTemplate>
                            <ContentTemplate>
                                <asp:UpdatePanel ID="updtpnlStudentUnits" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <table id="Table2">
                                            <tr>
                                                <td>
                                                    <asp:Label ID="unitsFilterLabel" CssClass="formLabel" runat="server" AssociatedControlID="ddEnrolled"
                                                        Text="Filter" ToolTip="Choose the filter:"></asp:Label>
                                                </td>
                                                <tr>
                                                    <td>
                                                        <asp:DropDownList ID="ddEnrolled" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddEnrolled_SelectedIndexChanged">
                                                            <asp:ListItem Value="true">Enrolled</asp:ListItem>
                                                            <asp:ListItem Value="false">Not Enrolled</asp:ListItem>
                                                            <asp:ListItem Value="-1">All</asp:ListItem>
                                                        </asp:DropDownList>
                                                    </td>
                                                </tr>
                                        </table>
                                        <br />
                                        <asp:GridView ID="gvUnits" runat="server" AutoGenerateColumns="False" DataSourceID="ldsStudentUnits"
                                            SkinID="Results" AllowSorting="True">
                                            <Columns>
                                                <asp:BoundField DataField="UnitCode" HeaderText="Code" SortExpression="UnitCode" />
                                                <asp:BoundField DataField="UnitName" HeaderText="Name" SortExpression="UnitName" />
                                                <asp:BoundField DataField="IsCurrentlyEnrolled" HeaderText="IsCurrentlyEnrolled"
                                                    SortExpression="IsCurrentlyEnrolled" />
                                                <asp:BoundField DataField="DateCreated" HeaderText="Date Created" SortExpression="DateCreated" />
                                                <asp:BoundField DataField="DateUpdated" HeaderText="Date Updated" SortExpression="DateUpdated" />
                                                <asp:BoundField DataField="CreatedBy" HeaderText="Created By" SortExpression="CreatedBy" />
                                                <asp:BoundField DataField="UpdatedBy" HeaderText="Updated By" SortExpression="UpdatedBy" />
                                            </Columns>
                                        </asp:GridView>
                                    </ContentTemplate>
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="SelectedIndexChanged" />
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="DataBound" />
                                    </Triggers>
                                </asp:UpdatePanel>
                                <asp:Timer ID="SaveAttribueLabelCounter" runat="server">
                                </asp:Timer>
                                <br />
                                <asp:LinqDataSource ID="ldsStudentUnits" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                                    TableName="StudentUnits" OnSelecting="ldsStudentUnits_Selecting">
                                </asp:LinqDataSource>
                            </ContentTemplate>
                        </ajaxToolkit:TabPanel>
                        <ajaxToolkit:TabPanel ID="tabpnlPlacementHistory" runat="server" HeaderText="Placement Histroy">
                            <HeaderTemplate>
                                Placements
                            </HeaderTemplate>
                            <ContentTemplate>
                                <asp:UpdatePanel ID="updtPnlPlacementFilters" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <table id="Table1">
                                            <tr>
                                                <td>
                                                    <asp:Label ID="txtPlacementSearchCompletionStatus" CssClass="formLabel" runat="server"
                                                        AssociatedControlID="ddSearchCompletionStatus" Text="Status" ToolTip="Choose the completion status:"></asp:Label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:DropDownList ID="ddSearchCompletionStatus" runat="server" DataSourceID="ldsCompletionsStatus"
                                                        DataTextField="CompletionStatusName" DataValueField="CompletionStatusId" OnDataBinding="ddSearchCompletionStatus_DataBinding"
                                                        OnDataBound="ddSearchCompletionStatus_DataBound" OnSelectedIndexChanged="ddSearchCompletionStatus_SelectedIndexChanged"
                                                        AutoPostBack="True" ValidationGroup="filterPlacements">
                                                    </asp:DropDownList>
                                                </td>
                                        </table>
                                    </ContentTemplate>
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="SelectedIndexChanged" />
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="DataBound" />
                                    </Triggers>
                                </asp:UpdatePanel>
                                <br />
                                <asp:UpdatePanel ID="UpdatepnlPlacements" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <asp:GridView ID="gvStudentPlacements" runat="server" AllowPaging="True" AllowSorting="True"
                                            DataSourceID="ldsStudentPlacements" SkinID="Results" DataKeyNames="AllocationId"
                                            PageSize="15" AutoGenerateColumns="False" OnRowUpdating="gvStudentPlacements_RowUpdating">
                                            <Columns>
                                                <asp:CommandField ShowEditButton="True" ButtonType="Image" CancelImageUrl="~/Images/Icons/against.gif"
                                                    EditImageUrl="~/Images/Icons/refresh.gif" UpdateImageUrl="~/Images/Icons/diskette.gif" />
                                                <asp:BoundField DataField="VenueName" HeaderText="Venue" SortExpression="VenueName"
                                                    ReadOnly="True" />
                                                <asp:BoundField DataField="UnitCode" HeaderText="Unit Code" SortExpression="UnitCode"
                                                    ReadOnly="True" />
                                                <asp:BoundField DataField="CampusCode" HeaderText="Campus" SortExpression="CampusCode"
                                                    ReadOnly="True" />
                                                <asp:BoundField DataField="SemesterId" HeaderText="Semester" SortExpression="SemesterId"
                                                    ReadOnly="True" />
                                                <asp:BoundField DataField="Year" HeaderText="Year" SortExpression="Year" ReadOnly="True" />
                                                <asp:BoundField DataField="DateStart" DataFormatString="{0:dd-MMM-yyyy}" HeaderText="Start Date"
                                                    SortExpression="DateStart" ReadOnly="True" />
                                                <asp:BoundField DataField="DateEnd" DataFormatString="{0:dd-MMM-yyyy}" HeaderText="End Date"
                                                    SortExpression="DateEnd" ReadOnly="True" />
                                                <asp:TemplateField HeaderText="Status" SortExpression="CompletionStatus">
                                                    <ItemTemplate>
                                                        <%#Eval("CompletionStatus")%>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:DropDownList ID="ddCompletionStatus" runat="server" DataSourceID="ldsCompletionsStatus"
                                                            DataTextField="CompletionStatusName" DataValueField="CompletionStatusId" SelectedValue='<%# Bind("CompletionStatusId") %>'>
                                                        </asp:DropDownList>
                                                    </EditItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                            <EmptyDataTemplate>
                                                No placements found for this student for the selected status.
                                            </EmptyDataTemplate>
                                        </asp:GridView>
                                        <asp:LinqDataSource ID="ldsStudentPlacements" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                                            EnableUpdate="True" TableName="Allocations" OnSelecting="ldsStudentPlacements_Selecting">
                                        </asp:LinqDataSource>
                                        <asp:LinqDataSource ID="ldsCompletionsStatus" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                                            TableName="CompletionStatus">
                                        </asp:LinqDataSource>
                                    </ContentTemplate>
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="ddSearchCompletionStatus" EventName="TextChanged" />
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="DataBound" />
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="SelectedIndexChanged" />
                                    </Triggers>
                                </asp:UpdatePanel>
                            </ContentTemplate>
                        </ajaxToolkit:TabPanel>
                        <ajaxToolkit:TabPanel ID="tabpnlAttributes" runat="server" HeaderText="Attributes">
                            <ContentTemplate>
                                <asp:UpdatePanel ID="updtpnlAttributes" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <asp:GridView ID="gvStudentAttributes" runat="server" AutoGenerateColumns="False"
                                            DataKeyNames="StudentAttributeID" DataSourceID="ldsStudentAttributes" OnRowDataBound="gvStudentAttributes_RowDataBound"
                                            ShowHeader="False" SkinID="Results">
                                            <Columns>
                                                <asp:BoundField DataField="StudentAttributeName" ShowHeader="False" SortExpression="StudentAttributeName" />
                                                <asp:TemplateField ShowHeader="False">
                                                    <ItemTemplate>
                                                        <asp:CheckBox ID="cbEditStudentAttribute" runat="server" />
                                                        <asp:TextBox ID="txtEditStudentAttributeExpiryDate" runat="server" MaxLength="10"
                                                            Width="70px"></asp:TextBox>
                                                        <ajaxToolkit:CalendarExtender ID="ceStudentAttributeExpiryDate" runat="server" TargetControlID="txtEditStudentAttributeExpiryDate">
                                                        </ajaxToolkit:CalendarExtender>
                                                        <asp:TextBox ID="txtHiddenLinkId" runat="server" Style="display: none;" Text="0"
                                                            Width="0px"></asp:TextBox>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                        </asp:GridView>
                                        <asp:LinqDataSource ID="ldsStudentAttributes" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                                            OnSelecting="ldsStudentAttributes_Selecting" TableName="UserStudentAttributes">
                                        </asp:LinqDataSource>
                                        <br />
                                        <asp:ImageButton ID="SaveAttributes" runat="server" CausesValidation="False" ImageUrl="~/Images/Icons/diskette.gif"
                                            ToolTip="Save" OnClick="SaveAttributes_Click" />
                                    </ContentTemplate>
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="DataBound" />
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="SelectedIndexChanged" />
                                    </Triggers>
                                </asp:UpdatePanel>
                            </ContentTemplate>
                            <HeaderTemplate>
                                Attributes
                            </HeaderTemplate>
                        </ajaxToolkit:TabPanel>
                        <ajaxToolkit:TabPanel ID="tabpnlComments" runat="server" HeaderText="Comments">
                            <HeaderTemplate>
                                Comments
                            </HeaderTemplate>
                            <ContentTemplate>
                                <asp:UpdatePanel ID="UpdatePnlNotes" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <asp:GridView ID="gvNotes" runat="server" AutoGenerateColumns="False" EmptyDataText="No comments have been added for this student."
                                            ShowFooter="true" ShowHeader="False" SkinID="Notes" Width="90%" DataKeyNames="NoteId"
                                            OnRowUpdating="gvNotes_RowUpdating" AllowSorting="True" DataSourceID="ldsComments"
                                            Style="margin-right: 112px">
                                            <Columns>
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <hr style="height: 1px" />
                                                        <p>
                                                            Created On:
                                                            <asp:Label ID="lblCommentDateCreated" runat="server" Text='<%# Bind("DateCreated") %>'></asp:Label>
                                                            By:
                                                            <asp:Label ID="lblCommentCreatedBy" runat="server" Text='<%# Bind("CreatedBy") %>'></asp:Label>
                                                            <br />
                                                            Last Updated On:
                                                            <asp:Label ID="lblCommentDateUpdated" runat="server" Text='<%# Bind("DateUpdated") %>'></asp:Label>
                                                            By:
                                                            <asp:Label ID="lblCommentUpdatedBy" runat="server" Text='<%# Bind("UpdatedBy") %>'></asp:Label>
                                                        </p>
                                                        <br />
                                                        Comment:
                                                        <asp:Label ID="lblComment" runat="server" Text='<%# Bind("NoteText") %>'></asp:Label>
                                                        <br />
                                                        <br />
                                                        <asp:ImageButton ID="BtnEdit" runat="server" CausesValidation="False" CommandName="Edit"
                                                            ImageUrl="~/Images/Icons/refresh.gif" ToolTip="Edit" />&#160;&nbsp;
                                                        <asp:ImageButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
                                                            ImageAlign="Baseline" ImageUrl="~/Images/Icons/x.gif" ToolTip="Delete" ValidationGroup="insertCategory" />
                                                        &nbsp;
                                                        <ajaxToolkit:ConfirmButtonExtender ID="cbeDeleteNote" runat="server" ConfirmText="Are you sure that you want to delete this note?"
                                                            TargetControlID="DeleteButton">
                                                        </ajaxToolkit:ConfirmButtonExtender>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:TextBox ID="txtEditNote" runat="server" Height="80px" MaxLength="8000" TextMode="MultiLine"
                                                            Width="90%" Text='<%# Bind("NoteText") %>'></asp:TextBox><br />
                                                        <asp:ImageButton ID="Updatebtn" runat="server" CommandName="Update" ImageUrl="~/Images/Icons/diskette.gif"
                                                            CausesValidation="false" ToolTip="Update" />
                                                        &nbsp;&nbsp;
                                                        <asp:ImageButton ID="CancelBtn" runat="server" CausesValidation="False" CommandName="Cancel"
                                                            ImageUrl="~/Images/Icons/against.gif" ToolTip="Cancel" />
                                                    </EditItemTemplate>
                                                    <FooterTemplate>
                                                    </FooterTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                        </asp:GridView>
                                        <br />
                                        <p style="cursor: hand">
                                            <img alt="" src="../Images/Icons/plus.gif" onclick="showAddNote();" /></p>
                                        <div style="display: none;" id="divAddNote">
                                            <fieldset id="fldAddNote">
                                                <legend id="lgdAddNote">Add Note</legend>
                                                <asp:UpdatePanel ID="updtpnlNewNote" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <asp:TextBox ID="txtAddNewNote" runat="server" Height="80px" MaxLength="8000" TextMode="MultiLine"
                                                            Width="90%"></asp:TextBox><br />
                                                        <p style="cursor: hand">
                                                            <asp:ImageButton ID="SaveBtn" runat="server" OnClick="btnSaveNote_Click" ImageUrl="~/Images/Icons/diskette.gif"
                                                                CausesValidation="false" ToolTip="Save" />
                                                            <img alt="" src="../Images/Icons/against.gif" title="Cancel" onclick="hideAddNote();" /></p>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </fieldset>
                                        </div>
                                        <asp:LinqDataSource ID="ldsComments" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
                                            EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="Notes"
                                            OnSelecting="ldsComments_Selecting">
                                        </asp:LinqDataSource>
                                    </ContentTemplate>
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="DataBound" />
                                        <asp:AsyncPostBackTrigger ControlID="gvStudents" EventName="SelectedIndexChanged" />
                                    </Triggers>
                                </asp:UpdatePanel>
                            </ContentTemplate>
                        </ajaxToolkit:TabPanel>
                    </ajaxToolkit:TabContainer>
                </div>
            </div>
        </div>
    </div>
    <div id="ft">
        &nbsp;
    </div>
    <!--Object Data Sources ************************************************* -->
    <asp:ObjectDataSource ID="odsCourses" runat="server" DeleteMethod="DeleteAllWDivisionId"
        InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="SelectAllWDivisionId"
        TypeName="PlacementManager.CourseComponent" UpdateMethod="Update">
        <DeleteParameters>
            <asp:Parameter Name="DivisionId" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="CourseId" Type="Int32" />
            <asp:Parameter Name="DivisionId" Type="Int32" />
            <asp:Parameter Name="CourseCode" Type="String" />
            <asp:Parameter Name="CourseName" Type="String" />
            <asp:Parameter Name="IsActive" Type="Boolean" />
            <asp:Parameter Name="DateCreated" Type="DateTime" />
            <asp:Parameter Name="CreatedBy" Type="String" />
            <asp:Parameter Name="DateUpdated" Type="DateTime" />
            <asp:Parameter Name="UpdatedBy" Type="String" />
        </UpdateParameters>
        <SelectParameters>
            <asp:SessionParameter Name="DivisionId" SessionField="DivisionId" Type="Int32" />
            <asp:Parameter DefaultValue="CourseCode" Name="sortExpression" Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="DivisionId" Type="Int32" />
            <asp:Parameter Name="CourseCode" Type="String" />
            <asp:Parameter Name="CourseName" Type="String" />
            <asp:Parameter Name="IsActive" Type="Boolean" />
            <asp:Parameter Name="DateCreated" Type="DateTime" />
            <asp:Parameter Name="CreatedBy" Type="String" />
            <asp:Parameter Name="DateUpdated" Type="DateTime" />
            <asp:Parameter Name="UpdatedBy" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsStudentAttributes" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="SelectAllWDivisionId" TypeName="PlacementManager.StudentAttributeComponent">
        <SelectParameters>
            <asp:SessionParameter DefaultValue="" Name="DivisionId" SessionField="DivisionId"
                Type="Int32" />
            <asp:Parameter DefaultValue="DateCreated" Name="sortExpression" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:LinqDataSource ID="ldsStudentslists" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
        TableName="Users" OnSelecting="ldsStudentslists_Selecting">
    </asp:LinqDataSource>
    <asp:LinqDataSource ID="ldsStudentDetails" runat="server" ContextTypeName="PlacementManagerLinqDataContext"
        OnSelecting="ldsStudentDetails_Selecting" TableName="Users">
    </asp:LinqDataSource>
    </form>
</body>
</html>
